<?php
include('connection/connection.php');
include("arrayconfigException.php");
$columnPH=$arr_excep[0][0];
$columnTDS=$arr_excep[1][0];
$columnCL=$arr_excep[2][0];
$columnF=$arr_excep[3][0];
$columnNO3=$arr_excep[4][0];
$queryExcep="SELECT a.para_ph,a.para_tds,a.para_cl,a.para_f,a.para_no3,b.form_id FROM tbl_dtls_q3_water_source_detail a,tbl_dtls_q3_loc b where a.loc_id=b.id";
$resultExcep=mysql_query($queryExcep);
while($excepValue=mysql_fetch_row($resultExcep))
{
if($excepValue[0]=="")
{
$excepValue[0]=0;
}
if(!(($arr_excep[0][1] <= $excepValue[0]) && ($excepValue[0] <= $arr_excep[0][2])))
{
$queryPH="insert into tbl_lookup_range_exception values('','$excepValue[5]','$columnPH','$excepValue[0]',NOW(),'0')";
$resultPH=mysql_query($queryPH);
}

if($excepValue[1]=="")
{
$excepValue[1]=0;
}
if(!(($arr_excep[1][1] <= $excepValue[1]) && ($excepValue[1] <= $arr_excep[1][2])))
{
$queryPH="insert into tbl_lookup_range_exception values('','$excepValue[5]','$columnTDS','$excepValue[1]',NOW(),'0')";
$resultPH=mysql_query($queryPH);
}

if($excepValue[2]=="")
{
$excepValue[2]=0;
}
if(!(($arr_excep[2][1] <=$excepValue[2]) && ($excepValue[2] <= $arr_excep[2][2])))
{
$queryPH="insert into tbl_lookup_range_exception values('','$excepValue[5]','$columnCL','$excepValue[2]',NOW(),'0')";
$resultPH=mysql_query($queryPH);
}

if($excepValue[3]=="")
{
$excepValue[3]=0;
}
if(!(($arr_excep[3][1] <= $excepValue[3]) && ($excepValue[3] <= $arr_excep[3][2])))
{
$queryPH="insert into tbl_lookup_range_exception values('','$excepValue[5]','$columnF','$excepValue[3]',NOW(),'0')";
$resultPH=mysql_query($queryPH);
}

if($excepValue[4]=="")
{
$excepValue[4]=0;
}
if(!(($arr_excep[4][1] <= $excepValue[4]) && ($excepValue[4] <= $arr_excep[4][2])))
{
$queryPH="insert into tbl_lookup_range_exception values('','$excepValue[5]','$columnNO3','$excepValue[4]',NOW(),'0')";
$resultPH=mysql_query($queryPH);
}
}
?>
